#ifndef _USER_H_
#define _USER_H_

/**
 * Creates a new user tasks with the given priority and sets the
 * PC to the given function.
 */
int Create( int priority, void (*func) (), char *name );

/**
 * Returns the task ID of the executing task
 */
int MyTid();

/**
 * Returns the parent task ID of the executing task
 */
int MyParentTid();

/**
 * The calling task gives up the CPU time and is put to the back of
 * its ready queue.
 */
void Pass();

/**
 * The task's state is set to DEFUNCT and is not put back on the ready queue
 */
void Exit();

/**
 * Kills all tasks in the system, thereby ensuring that the kernel
 * exits on the next Schedule() attempt.
 */
void FingerOfDeath();

int Send( int tid, char *msg, int msglen, char *reply, int replylen );

int Receive(int *tid, char *msg, int len);

int Reply(int tid, char *reply, int len);

int RegisterAs(char *name);

int WhoIs(char *name);

int Delay(int ticks);

int Time();

int DelayUntil(int ticks);

int AwaitEvent( int eventid, char *event, int eventlen );

int NotifyEvent( int eventid, char *event, int eventlen );

int Hasc(int channel);

int Getc(int channel);

int Putc(int channel, char ch);

int PutStr(char *msg, int n);

void AcquireLock(int section);

void ReleaseLock(int section);

void Panic(char *fun_name, char *msg);

#endif // _USER_H_
